package com.qyhl.webtv.module_circle.circle.friend;

import android.content.Context;
import android.widget.ImageView;

import com.qyhl.webtv.commonlib.entity.circle.CircleHomeBean;

import java.util.List;

/**
 * Created by qyhl on 2018/1/23.
 */

public class FriendMomentPresenter implements FriendMomentContract.FriendPresenter {
    private FriendMomentContract.FriendView mView;
    private FriendMomentModel mModel;

    public FriendMomentPresenter(FriendMomentContract.FriendView mView) {
        this.mView = mView;
        this.mModel = new FriendMomentModel(this);
    }

    @Override
    public void getRecFriends() {
        mModel.getRecFriends();
    }

    @Override
    public void getContent(String lastId) {
        mModel.getContent(lastId);
    }

    @Override
    public void setRecFriends(List<CircleHomeBean.User> beanList) {
        mView.setRecFriends(beanList);
    }

    @Override
    public void setContent(List<CircleHomeBean> beanList, boolean isMore) {
        mView.setContent(beanList, isMore);
    }

    @Override
    public void setRecError() {
        mView.setRecError();
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.showMessage(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            case 3:
                mView.setLog(msg);
                break;
            case 4:
                mView.setError(msg);
                break;
            case 5:
                mView.showMessage(msg);
                break;
            default:
                break;
        }
    }

    @Override
    public void doFollow(String dstUserName, ImageView imageView,int position) {
        mModel.doFollow(dstUserName, imageView,position);
    }

    @Override
    public void undoFollow(String dstUserName, ImageView imageView,int position) {
        mModel.undoFollow(dstUserName, imageView,position);
    }

    @Override
    public void followSuccess(ImageView imageView,int position) {
        mView.followSuccess(imageView,position);
    }

    @Override
    public void followError(String msg,ImageView imageView) {
        mView.followError(msg,imageView);
    }

    @Override
    public void unFollowSuccess(ImageView imageView,int position) {
        mView.unFollowSuccess(imageView,position);
    }

    @Override
    public void unFollowError(String msg,ImageView imageView) {
        mView.unFollowError(msg,imageView);
    }

    @Override
    public void sendComment(String topicId, String content, String dstUsername) {
        mModel.sendComment(topicId, content, dstUsername);
    }

    @Override
    public void commentSuccess(int id,String msg, int code) {
        mView.commentSuccess(id,msg, code);
    }

    @Override
    public void commentError(String msg) {
        mView.commentError(msg);
    }

    @Override
    public String getCoin(Context context) {
        return mModel.getCoin(context);
    }

}
